<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
use JWTAuth;
use Auth;
class Controller extends BaseController
{
    use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;


    function __construct()
    {
        view()->share([
            '_system' => config('xSystem.system_login'),
            '_token' => $this->userAuth(),
        ]);
        $this->bibel();
    }


    protected function userAuth(){

        //81 hotel
        //$token ='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjYsImlzcyI6Imh0dHA6XC9cLzE5Mi4xNjguMS44MVwvYXV0aCIsImlhdCI6MTQ4MDQ3NzI4MiwiZXhwIjoxNTEyMDEzMjgyLCJuYmYiOjE0ODA0NzcyODIsImp0aSI6IjNhMDdjYjc3MjU2N2FjNmYzOTJmNjJmOTgyNGJjZGIyIn0.YwRSh5ZOIBuxIRFPSY2wnobdzWKfwl-TxJi4Hyw60tE';

        //250 hotel
        //$token ='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjcsImlzcyI6Imh0dHA6XC9cLzE5Mi4xNjguMS4yNTA6ODA4MFwvYXV0aCIsImlhdCI6MTQ4MDQ5MzkwNSwiZXhwIjoxNTEyMDI5OTA1LCJuYmYiOjE0ODA0OTM5MDUsImp0aSI6ImJkYjRmYzdjYjAwOTVmNGYzZDlmNDBlZWJkYmNkYTNlIn0.TiEF9dzZ-RiGDN_eIiQwLBxMq7CTpRQrURqoB11QA0c';

        //81 hotel_test
        $token ='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjcsImlzcyI6Imh0dHA6XC9cLzE5Mi4xNjguMS44MVwvYXV0aCIsImlhdCI6MTQ4MDQ5MDY1MiwiZXhwIjoxNTEyMDI2NjUyLCJuYmYiOjE0ODA0OTA2NTIsImp0aSI6ImJlMzYyNjMzMzEwOGNhNmJiZTc4MmU3MTQ3ZDFlNjU3In0.G3rqeBzHu9KZbQfrf9QLaHXY6-8sb3rmsdta95LKnVQ';

        return $token;
    }

    //思考, 源自Holy Bible
    private function bibel()
    {
        @$bibels = file('Bibel.txt');
        $size = count($bibels) / 2 - 1;
        $rand = rand(0, $size) * 2;
        $bibel = array(
            'cn' => $bibels[$rand + 1],
            'en' => $bibels[$rand]
        );

        view()->share('bibel', $bibel);
    }
}
